package com.inspur.edp.ai.flow.core.engine.databus;

import com.inspur.edp.ai.flow.engine.DataBus;

public class DataBusHolder {
    private final DataBus dataBus;
    private final long timestamp;
    private final long ttl; // 存活时间(毫秒)，-1表示永不过期

    DataBusHolder(DataBus data, long ttl) {
        this.dataBus = data;
        this.ttl = ttl;
        this.timestamp = System.currentTimeMillis();
    }

    boolean isExpired() {
        return ttl > 0 && (System.currentTimeMillis() - timestamp) > ttl;
    }
    public DataBus getDataBus() {
        return dataBus;
    }
}
